//
//  HZCaseManageViewController.m
//  MyDoctor
//
//  Created by 黑眼圈 on 16/5/5.
//  Copyright © 2016年 heiyan. All rights reserved.
//病例管理

#import "HZCaseManageViewController.h"
#import "HZUserInfoView.h"
#import "HZUserCaseTableView.h"
#import "HZAddCaseView.h"
#import "HZAddUserCaseViewController.h"

@interface HZCaseManageViewController ()<HZAddCaseViewDelegate>

///  用户信息
@property (nonatomic , strong) HZUserInfoView *userInfoView;

///  用户病例
@property (nonatomic , strong) HZUserCaseTableView *userCaseTableView;

///  添加病例
@property (nonatomic , strong) HZAddCaseView *addCaseView;

@end

@implementation HZCaseManageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //设置并添加子控件
    [self setupUI];
    
}


#pragma mark -
#pragma mark    设置并添加子控件
-(void)setupUI{
    
    ///  设置当前的View背景颜色
    self.view.backgroundColor = [UIColor colorWithRed:231/255.0 green:231/255.0 blue:231/255.0 alpha:1.0];
    
    
    //添加子控件
    [self.view addSubview:self.userInfoView];
    [self.view addSubview:self.addCaseView];
    [self.view addSubview:self.userCaseTableView];
    
    
    //约束
    [self.userInfoView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.left.right.equalTo(self.view);
        make.height.equalTo(@120);
    }];
    
    [self.addCaseView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.left.right.equalTo(self.view);
        make.height.equalTo(@50);
    }];
    
    [self.userCaseTableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.userInfoView.mas_bottom);
        make.left.right.equalTo(self.view);
        make.bottom.equalTo(self.addCaseView.top);
    }];
    

}

#pragma mark - 实现代理方法
-(void)addCaseView:(HZAddUserCaseViewController *)addCaseView{

    //创建用户病例对象
    HZAddUserCaseViewController *addVc = [[HZAddUserCaseViewController alloc]init];
    
    [self.navigationController presentViewController:addVc animated:YES completion:nil];
}

#pragma mark - 懒加载
-(HZUserInfoView *)userInfoView{
    
    if (!_userInfoView) {
        _userInfoView = [[HZUserInfoView alloc]init];
    }
    return  _userInfoView;
}

-(HZUserCaseTableView *)userCaseTableView{
    
    if (!_userCaseTableView) {
        _userCaseTableView = [[HZUserCaseTableView alloc]initWithFrame:CGRectZero style:UITableViewStylePlain];
    }
    return _userCaseTableView;
}

-(HZAddCaseView *)addCaseView{

    if (!_addCaseView) {
        _addCaseView = [[HZAddCaseView alloc]init];
        _addCaseView.delegate = self;
    }
    return _addCaseView;
}












@end



















